package com.usian.service;

import com.usian.dao.CategoryMapper;
import com.usian.pojo.Category;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CategoryService {
    @Autowired
    private CategoryMapper categoryMapper;


    public List<Category> findAll() {
      return   categoryMapper.selectAll();
    }

    public void add(Category category) {
        categoryMapper.insertSelective(category);
    }

    public void del(Integer id) {
        categoryMapper.deleteByPrimaryKey(id);
    }

    public void update(Category category) {
        categoryMapper.updateByPrimaryKeySelective(category);
    }

    public Category findById(Integer id) {
      return   categoryMapper.selectByPrimaryKey(id);
    }
}
